package io.renren.modules.sys.subject.service.impl;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.modules.sys.subject.dao.QuestionDao;
import io.renren.modules.sys.subject.entity.QuestionEntity;
import io.renren.modules.sys.subject.service.QuestionService;

/**
 * @author flagdied
 * @email 2481019556@qq.com
 * @date 2020-05-01 15:11:48
 */
@Service("questionService")
public class QuestionServiceImpl extends ServiceImpl<QuestionDao, QuestionEntity> implements QuestionService {
    @Autowired
    private QuestionDao questionDao;


    public int insertSelective(QuestionEntity record){
        return questionDao.insertSelective(record);
    }
    public void updateImageUrl(QuestionEntity record){
        questionDao.updateImageUrl(record);
    }

    @Override
    public PageUtils queryPage(Map<String, Object> params,Integer subjectNo) {
        IPage<QuestionEntity> page = this.page(
                new Query<QuestionEntity>().getPage(params),
                new QueryWrapper<QuestionEntity>().eq("subject",subjectNo)
        );

        return new PageUtils(page);
    }

}
